
import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

/**
 * @author Team Name: ByteCode
 * Team members: Kevin Conner, Vinesh Thakur, and James Yu
 *  MancalaTester Runs the main program.
 *
 */
public class MancalaTester 
{
   /**
    * The main method starts the program.
    * @param args String [] no value
    */
   public static void main(String[] args)
   {
      MancalaFrame mf = new MancalaFrame();
      MancalaDataModel mdm = new MancalaDataModel();

      String temp = JOptionPane.
            showInputDialog("How many stones do you want to play with? 3 or 4");
      

      if( temp == null)
         System.exit(0);
      int stone = Integer.parseInt(temp);
      if(stone < 3 || stone> 4)
      {
         mdm.updateAllPits(4);

         JOptionPane.showMessageDialog(null, "You chose out of the range!  Automatcally given 4 Stones per Pit.");
      }
      else
         mdm.updateAllPits(stone);
      Object[] strategy = {"Normal", "Alternate"};
      int style = JOptionPane.showOptionDialog(null,
            "Choose a Style",
            "Style",
            JOptionPane.DEFAULT_OPTION,
            JOptionPane.PLAIN_MESSAGE,
            null,
            strategy,
            strategy[1]);

      mdm.updateAllPits(stone);
      Container content = mf.getContentPane();
      mf.setSize(475,232);
      mf.setResizable(false);

      mf.setTitle("Mancala");
      MancalaBoardPanel mbp = new MancalaBoardPanel(style, mdm);
      content.add(mbp);
      mf.setVisible(true);
      mf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
   }
}
